# -*- coding: utf-8 -*-
# @Time    : 2022/1/28 13:11
# @Email   : 849080458@qq.com
# @Author  : zgh
# @FileName: day01_请求响应.py
# @Software: PyCharm
#
# from flask import Flask, request, redirect
#
# app = Flask(__name__)
# app.config['JSON_AS_ASCII'] = False
#
#
# @app.route('/')
# def index():
#     if request.args.get('username') is None:
#         return redirect('login')
#     return 'hello'
#
#
# @app.route('/login')
# def login():
#     return 'login'
#
# if __name__ == '__main__':
#     app.run(debug=True)


def longestPalindrome(self, s: str) -> str:
    n, m = 0, 0
    for i in range(len(s)):
        left, right = i, i
        while left >= 0 and s[left] == s[i]:
            left -= 1
        while right < len(s) and s[right] == s[i]:
            right += 1
        while left >= 0 and right < len(s) and s[left] == s[right]:
            left -= 1
            right += 1
        if m - n + 1 < right - left - 1:
            n, m = left + 1, right - 1
    return s[n:m + 1]
